<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['ischecklogin']=model('core/core')->checklogin('','',true);
	$_SESSION['merchid']=$this->model('merch')->checkmember();
	$return['list']=array();
	$return['params']['status']=0;
	$return['pcd']=$this->session('pcd')?:array('city'=>'');
	set_html('title','我的订单');
	exi($return);
}
/*******op*******/
if($_RQ['op']=='list'){
	$params=array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']);
	$params['status']=intval($_RQ['status']);
	$return['status']=$_RQ['status'];
	$pindex = max(1, intval($_RQ['page']));
	$psize = 20;
	$list=pdo_getslice('jy_daibao_order',$params,array($pindex,$psize),$total,$fields,'','id desc');	
	if($list){
		foreach($list as &$item){
			$item['yewu']=pdo_get('jy_daibao_yewu',array('id'=>$item['yewuid'],'uniacid'=>$_SESSION['uniacid']),array('id','title'));
			$item['merchinfo']=json_decode($item['merchinfo'],true);
			$item['fileds']=json_decode($item['fileds'],true);
			$item['statustitle']=$this->order_status[$item['status']];
			$item['typetitle']=$this->types[$item['type']];
			$item['createtime']=date('Y-m-d H:i:s', $item['createtime']);
		}
	}
	$return['list']=$list;
	exi($return);
}